package org.pada.domain;



import org.pada.domain.event.AbstractDomainEvent;
import org.pada.domain.event.EventBus;

import java.util.List;

/**
 * @author pengshen
 * @date 2022.05.20 09:09
 */
public interface AggregationRoot extends Aggregation {
    default void dispatchDomainEvent(AbstractDomainEvent event) {
        EventBus.dispatch(event);
    }

    default void dispatchDomainEvent(AbstractDomainEvent event, boolean async) {
        EventBus.dispatch(event, async);
    }

    default void dispatchDomainEvent(List<AbstractDomainEvent> events) {
        EventBus.dispatchDomainEvent(events);
    }

    default void dispatchDomainEvent(List<AbstractDomainEvent> events, boolean async) {
        EventBus.dispatchDomainEvent(events, async);
    }

}
